﻿
////////////////////////////////////////////////////////////////////////////////////////////
// 文件名: SysRoleBLL.gen.cs
//
// 模块名称: SysRoleBll
//
// 作者: LPC
//
// 历史记录（记录修改记录，修改文件后请添加修改记录，注明修改时间、修改人，修改内容）:
// 13-2-20    LPC    创建文件
////////////////////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Text;
using Common;
using DAL;
using Model;

namespace BLL
{
    /// <summary>
    /// SysRoleInfo表业务逻辑层
    /// </summary>
    public partial class SysRoleBLL //: BaseBLL
    {
        const string ErrorCodeSelect = "";    //查询异常编码
        const string ErrorCodeInsert = "";    //添加异常编码
        const string ErrorCodeUpdate = "";    //修改异常编码
        const string ErrorCodeDelete = "";    //删除异常编码

        /// <summary>
        /// 创建BLL对象
        /// </summary>
        /// <param name="user">系统的登录用户</param>
        //public SysRoleBLL(IUserInfo user) : base(user)
        //{
        //}

        /// <summary>
        /// 根据Id字段获取SysRoleInfo实体对象
        /// </summary>
        /// <param name="id">Id</param>
        /// <returns>SysRoleInfo实体对象</returns>
        public static SysRoleInfo GetInfoById(string id)
        {
            try
            {
                return SysRoleDAL.GetInfoById(id);
            }
            catch (Exception ex)
            {
                Logger.LogError("SysRoleBLL", "GetInfo", AppError.EROR, 0, ex, "获取SysRoleBll信息出错。",
                                String.Format("id = {0}", id));
                throw new SystemException(ErrorCodeSelect, ex);
            }
        }

        /// <summary>
        /// 往SysRoleInfo表内添加新记录
        /// </summary>
        /// <param name="SysRoleInfo">SysRoleInfo实体对象</param>
        /// <returns>添加记录索引值</returns>
        public int Insert(SysRoleInfo sysRoleInfo)
        {
            try
            {
                int identity = SysRoleDAL.Insert(sysRoleInfo);
                return identity;
            }
            catch (Exception ex)
            {
                Logger.LogError("SysRoleBLL", "Insert", AppError.EROR, 0, ex, "添加SysRoleBll信息出错。", null);
                throw new SystemException(ErrorCodeInsert, ex);
            }
        }

        /// <summary>
        /// 更新SysRoleInfo表记录
        /// </summary>
        /// <param name="sysRoleInfo">SysRoleInfo实体对象</param>
        public void Update(SysRoleInfo sysRoleInfo)
        {
            try
            {
                SysRoleDAL.Update(sysRoleInfo);
            }
            catch (Exception ex)
            {
                Logger.LogError("SysRoleBLL", "Update", AppError.EROR, 0, ex, "更新SysRoleBll信息出错。",
                                String.Format("Id = {0}", sysRoleInfo.Id));
                throw new SystemException(ErrorCodeUpdate, ex);
            }
        }

        /// <summary>
        /// 根据Id字段获取SysRoleInfo实体对象
        /// </summary>
        /// <param name="id">Id</param>
        public void Delete(string id)
        {
            try
            {
                SysRoleDAL.Delete(id);
            }
            catch (Exception ex)
            {
                Logger.LogError("SysRoleBLL", "Delete", AppError.EROR, 0, ex, "删除SysRoleBll信息出错。",
                                String.Format("id = {0}", id));
                throw new SystemException(ErrorCodeDelete, ex);
            }
        }


        /// <summary>
        /// 根据Id字段获取SysRoleInfo实体对象
        /// </summary>
        /// <param name="id">Id</param>
        /// <returns>List<SysRoleInfo>实体对象</returns>
        public static IList<SysRoleInfo> GetList(IDataParameter[] par)
        {
            try
            {
                return SysRoleDAL.GetList(par);
            }
            catch (Exception ex)
            {
                Logger.LogError("SysRoleBLL", "GetInfo", AppError.EROR, 0, ex, "获取SysRoleBll信息出错。",
                                "");
                throw new SystemException(ErrorCodeSelect, ex);
            }
        }

        /// <summary>
        /// 根据Id字段获取SysRoleInfo实体对象
        /// </summary>
        /// <param name="id">Id</param>
        /// <returns>List<SysRoleInfo>实体对象</returns>
        public static int GetListCount(IDataParameter[] par)
        {
            try
            {
                return SysRoleDAL.GetListCount(par);
            }
            catch (Exception ex)
            {
                Logger.LogError("SysRoleBLL", "GetInfo", AppError.EROR, 0, ex, "获取SysRoleBll信息出错。",
                                "");
                throw new SystemException(ErrorCodeSelect, ex);
            }
        }

        public int InsertCompetence(IDataParameter[] paras)
        {
            try
            {
                return SysRoleDAL.InsertCompetence(paras);
            }
            catch (Exception ex)
            {
                Logger.LogError("SysRoleBLL", "GetInfo", AppError.EROR, 0, ex, "获取SysRoleBll信息出错。",
                                "");
                throw new SystemException(ErrorCodeSelect, ex);
            }
        }

        public int DeleteCompetence(IDataParameter[] paras1)
        {
            try
            {
                return SysRoleDAL.DeleteCompetence(paras1);
            }
            catch (Exception ex)
            {
                Logger.LogError("SysRoleBLL", "GetInfo", AppError.EROR, 0, ex, "获取SysRoleBll信息出错。",
                                "");
                throw new SystemException(ErrorCodeSelect, ex);
            }
        }

        public int InsertTarge(IDataParameter[] paras)
        {
            return SysRoleDAL.InsertTarge(paras);
        }

        public int InsertUser(IDataParameter[] paras)
        {
            return SysRoleDAL.InsertUser(paras);
        }

        public int DeleteTarge(IDataParameter[] paras1)
        {
            return SysRoleDAL.DeleteTarge(paras1);
        }

        public int DeleteUser(IDataParameter[] paras1)
        {
            return SysRoleDAL.DeleteUser(paras1);
        }
        public DataTable SelectCompetence(IDataParameter[] paras1)
        {
            return SysRoleDAL.SelectCompetence(paras1);
           
        }
        public DataTable SelectTarge(IDataParameter[] paras1)
        {
            return SysRoleDAL.SelectTarge(paras1);
        }

        public DataTable SelectUser(IDataParameter[] paras1)
        {
            return SysRoleDAL.SelectUser(paras1);
        }

        public static DataTable GetRoleTypeByUserName(SqlParameter[] paramsdb)
        {
            return SysRoleDAL.GetRoleTypeByUserName(paramsdb);
        }

        public int DeleteRow(SqlParameter[] par)
        {
            return SysRoleDAL.DeleteRow(par);
        }

        public static int GetRoleInfoByCode(SqlParameter[] par)
        {
            return SysRoleDAL.GetRoleInfoByCode(par);
        }
    }
}